#include "TObjectList.h"
#include "TObject.h"

#include "iostream"
using namespace std;
TObjectList::TObjectList()
{
     m_list.clear();
}
TObjectList::TObjectList(TObject * obj)
{
    m_list.clear(); push_back(obj);
}
TObjectList::TObjectList(TObjectList * obj )
{
    m_list.clear(); push_back(obj);
}

TObjectList::~TObjectList()
{//cout<<"TObjectList deconstrucation"<<endl;
    for(vector<TObject *>::iterator it = m_list.begin(); it != m_list.end(); it++)
        delete *(it);
    m_list.clear();
}

void TObjectList::push_back(TObject * obj)
{
     m_list.push_back(obj);
}
void TObjectList::push_back(TObjectList * obj)
{
     TObject * tmp = new TObject(obj); m_list.push_back(tmp);
}

TObject * TObjectList::at(int index)
{
     return m_list.at(index);
}
TObject * TObjectList::getObject(int index)
{
     return m_list.at(index);
}
TObjectList * TObjectList::getObjectList(int index)
{
    return m_list.at(index)->getObjectList();
}
